from django import forms

from blog.models import BlogCategory


class PostBlogForm(forms.Form):
    title = forms.CharField(max_length=200, min_length=2, error_messages={
        'required': '标题不能为空',
        'max_length': '标题不能超过200个字符',
        'min_length': '标题不能少于2个字符',
    })
    content = forms.CharField(widget=forms.Textarea, strip=True, min_length=2, error_messages={
        'required': '内容不能为空', 'min_length': '内容不能少于2个字符', })
    category = forms.ModelChoiceField(queryset=BlogCategory.objects.all(), empty_label="请选择分类", error_messages={
        'required': '请选择分类', })


